package org.starapp.utils;

import java.util.List;
import java.util.Set;

public class ArrayUtils {
	/**
	 * String[] is Empty ?
	 * @param strings
	 * @return
	 */
	public static boolean isEmpty(String[] strings) {
		return (strings == null || strings.length == 0);
	}

	/**
	 * Convert List<String> to String[]
	 * @param list
	 * @return
	 */
	public static String[] list2ArrayString(List<String> list) {
		if (list == null || list.size() == 0) {
			return null;
		}
		String[] strs = new String[list.size()];
		return list.toArray(strs);
	}

	public static String[] set2ArrayString(Set<String> list) {
		if (list == null || list.size() == 0) {
			return null;
		}
		String[] strs = new String[list.size()];
		return list.toArray(strs);
	}

}
